package com.example.spring.boot.spring.conf;

import com.example.spring.boot.spring.adapter.MyRequestMappingHandlerAdapter;
import com.example.spring.boot.spring.conf.datasource.MySqldbProperties;
import com.example.spring.boot.spring.interceptor.DemoHandlerInterceptor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;

@Configuration

/*@ImportResource("spring-datasource.xml")*/

public class MyWebMvcConfigurationSupport extends WebMvcConfigurationSupport {


    @Override
    protected RequestMappingHandlerAdapter createRequestMappingHandlerAdapter() {
        return new MyRequestMappingHandlerAdapter();
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
           registry.addInterceptor(new DemoHandlerInterceptor());
    }
}
